package com.valkyries.jhhj.service.impl;

import com.mybatisflex.core.query.QueryWrapper;
import com.valkyries.jhhj.domain.UserRole;
import com.valkyries.jhhj.mapper.UserRoleMapper;
import com.valkyries.jhhj.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.valkyries.jhhj.domain.table.Tables.USER_ROLE;

/**
 * 用户角色关联Service业务层处理
 */

@Service
public class UserRoleServiceImpl implements UserRoleService {
    @Autowired
    private UserRoleMapper userRoleMapper;


    /**
     * 查询用户id对应的所有角色
     */
    @Override
    public List<UserRole> queryListByLoginId(Object loginId) {
        return userRoleMapper.selectListByQuery(new QueryWrapper()
                .where(USER_ROLE.USER_ID.eq(loginId))
        );
    }
}
